Parameters are set via a 2 step process both within the Expression Editor via the Query and again via the Parameters used for Filters in the Report viewer.
Parameter Settings Step 1
To configure parameters - on the main Report Designer page select the data source Fields icon from the far right menu.
- Click on the data fields icon in the right side menu
- Expand the data source to reveal the stored procedure (query) name
- Click on the stored procedure title to show the editing tools then click the Edit query icon (pen).
The selected query is pre-selected in the 'Data Source Wizard' window so just select Next.
In the next panel of the Data Source Wizard, a list of the available parameters from the query is shown.
Note the userid is automatically set so requires no further configuration.
Note: While this list shows all parameters available, these must have been selected to add when the Designing the Report
- Expand Parameters*
- Double click on userid which passes this into the top of the panel (or you can just type ?Userid in at 3, (ensure to put the ? in front).
- Remove any detail like a 0 including spaces after the Parameter name (backspace to the d).
Click Save then Finish
* Tip - Ensure your screen resolution is set to when working with the Expression Editor or you may not be able to see all of the available data and functions.
Step 2 Configure Parameters
Enabling Parameters for filtering a Report is a 2 step process where in Step 1 - the Parameter data field is first passed to the stored procedure in the Expression Editor and then Step 2 - the data field is added to the Report as a Parameter to enable it as a filter.
Date filters should be used where available otherwise all results will be returned.
Adding Parameters for Filters
Parameters are available for all Reports (these vary per Report), you have the option to add these to the query which then enables the Report to be filtered by any of those Parameters. For example if results are to be filtered by Department and\or File or Dates.
Note: The Parameter fields available, are only those shown in the Data Source Wizard for the selected query. To view a list of the Parameters available for any Stored Procedure, in the Help pages see the Parameters column in the Stored Procedures List
Where data volumes returned are likely to be very high, to prevent overloading the system it is recommended to use Date parameters to filter results. E.G Filter the Audit or Document list Report by adding and using the Start (From) Date and End (To) Date.
Step 1: Pass the Parameter to the Report
To pass a Parameter to the Report - on the main Report Designer page select the data source Fields icon from the far right menu.
- Click on the data fields icon in the right side menu
- Expand the data source to reveal the stored procedure name
- Click on the stored procedure to show the editing tools. Click the Edit query icon (pen).
The selected query is preselected in the 'Data Source Wizard' so just select Next.
- In the next panel of the Data Source Wizard, expand the required Parameter and change the Type to Expression.
- Next, to set the value - click on the ellipsis in the Value to open the Expression Editor.
- In the top section at 1, enter the parameter name exactly how it is shown (in the list of available parameters for that Stored Procedure) with no spaces and always starts with a leading ? Use the exact format for the data field including caps where shown.
E.G for File Title the expression may be listed as ?FileTitle or ?FileName (depending on how it is named in the Stored Procedure) or for Document Number the expression is ?DocNumber or for Date ?FromDate or ?DocumentCreationDateFrom.
The important part is to ensure that the Parameter name is added with a preceeding? and the name and format matches exactly to the name shown in the Data Source Wizard.
- Click OK
- Repeat Step 1 - 3 for any of the other Parameters you want to pass to the Report (and were included in the Report design when selecting the Data Fields)
- Click Finish
Step 2 Add the Parameter to the Report.
In the Field List, click on ?Parameters and a + sign shows. Click the + to Add a Parameter.
1: In the Add Parameter panel enter the parameter name*, this time without the ? prefix.
2: Add a description which is free text and is what will show as the name of that filter so it doesn't have to be the same name as the parameter. E.G for the parameter DocNumber the description could be 'Document Number or Information Report Number' or "IR#" etc.
The visible and Enabled fields should be Yes. No need to redo the type, expression or value as those have already been set in the previous step.
*Note: The formatting of the Parameter name must match exactly the formatting used of the parameter when it was added in the Expression Editor. E.g if capitals were used for the first letters then that must be repeated when adding a Parameter. Example - if the case format for the value for FileTitle (with capital first letters) is used in the Data Source Wizard/Expression Editor- then use the same case format (minus the preceeding ?) for FileTitle when adding it as a Parameter and NOT lowercase filetitle.
In the Report viewer, if results are not filtering as expected then check that the Parameter case format matches that value in the Data Source Wizard/Expression Editor (minus the preceeding ?).
Date Parameter
If the value is a Date specify the following
- Name - FromDate (or whatever is the exact match to the name given in the Data Source Wizard) (no space between)
- Description - From Date (free text)
- Orientation - Horizontal
- Type - Date which opens a date selector where you can set the default From Date.
- Visible and Enabled - Yes
- Allow Null value - check this
- Tag - leave blank
- Expression - blank (as this has been pre-set in the Expression editor)
- Option 1 - Value - click x to clear the date (the calendar icon should still be showing)
Option 2 - Value - click into the date field and select the date
- Value Source leave as (none)
- Click OK to finish
The Parameter is now added and can be used to filter data in the Report in the Report Viewer.
Note if the 'Allow Null value' is not checked and a date shows in the Value (as per Option 2) then this date becomes the default date setting in the Report viewer. In the Report viewer the date range required can be selected to over-ride the set dates. Or the date can be edited at any time in the Designer - see the following article - Updating a Date Parameter.
Save all changes again in the main report menu before exiting the Report Designer.
Updating a Date Parameter
Where a date parameter has not had the date removed from the value - that date is set and will always show the same date in the Report Viewer unless updated in the Designer.
To update the Date specified in a Date Parameter, open the Report Designer and the Field list. Expand Parameters and select the Date Parameter and Edit. Edit the date using the date control and click OK.
Save the Report. In the Report Viewer the date will now show the updated date value.